<template>
  <div class="evaluationBox">
    <div class="fromTop">
      <TopFilter ref="topFilter" :list="topFilterList" :cols="3" :collapse="false" :isSubmitBtn="false" @filterChange="changeHandle"></TopFilter>
    </div>
    <div class="table_main">
      <div class="main_left">
        <LazyLoadTab v-model="activeName" :tabMenus="menus" />
      </div>
      <div class="main_right">
        <div class="patternbox">
          <patterns :getdata="patternData" />
        </div>
        <div class="invoicebox">
          <invoice :getdata="invoiceData" />
        </div>
      </div>
    </div>
    <div class="table_lang">
      <div class="lang_left">
        <div class="Statisticsbox">
          <Statistics :getdata="statisticsData" />
        </div>

        <div class="btn_top">
          <el-button type="primary" icon="el-icon-plus" :disabled="btnDisabled.addbtn" @click="addchange()">新建</el-button>
          <el-button type="primary" icon="el-icon-edit" :disabled="btnDisabled.import">导入工单</el-button>
          <el-button type="primary" icon="el-icon-printer" :disabled="btnDisabled.combination" @click="combinationFun">维修组合</el-button>
          <el-button type="primary" icon="el-icon-folder" :disabled="btnDisabled.save" @click="saveDataFun()">保存</el-button>
          <el-button type="primary" icon="el-icon-refresh-left" :disabled="btnDisabled.emit">编辑</el-button>
          <el-button type="primary" icon="el-icon-delete" :disabled="btnDisabled.cancel" @click="cancelFun()">取消</el-button>
        </div>
        <div class="btn_bottom">
          <el-button type="primary" icon="el-icon-delete" :disabled="btnDisabled.void">作废</el-button>
          <el-button type="primary" icon="el-icon-delete" :disabled="btnDisabled.export">导出工单</el-button>
          <el-button type="primary" icon="el-icon-delete" :disabled="btnDisabled.Printing1" @click="Printing1Fun">打印结算单</el-button>
          <el-button type="primary" icon="el-icon-delete" :disabled="btnDisabled.Printing2">打印估价单</el-button>
        </div>
      </div>
      <div class="lang_right">
        <sumComponents :getdata="sumData" />
      </div>
    </div>
    <Drawer :visible.sync="estimateVisible" title="估价单选择" destroyOnClose :containerStyle="{ height: 'calc(100% - 60px)', overflow: 'auto', paddingBottom: '60px' }">
      <estimate :getdata="estimateData" @close="closeestimate" @changedata="estimateSubmit"></estimate>
    </Drawer>
    <Drawer :visible.sync="ownerVisible" title="选择车主" destroyOnClose :containerStyle="{ height: 'calc(100% - 60px)', overflow: 'auto', paddingBottom: '60px' }">
      <owner :getdata="ownerData" @close="closeOwner" @changedata="ownerSubmit"></owner>
    </Drawer>
    <!-- 维修组合 -->
    <Drawer :visible.sync="isRepcombination" title="维修组合" destroyOnClose :containerStyle="{ height: 'calc(100% - 60px)', overflow: 'auto', paddingBottom: '60px' }">
      <!-- <Repcombination :repirlist="repirlist" @close="closeRepcombination" @WxxmList="WxxmList" /> -->
    </Drawer>
    <div v-if="printShow">
      <BasePrint ref="print" :data="printList" template="template1" />
    </div>
  </div>
</template>
<script>
import moment from 'moment';
import { dictionary } from '@/utils/dictMixin';
import patterns from './Pattern.vue';
import owner from './owner.vue';
import estimate from './estimate.vue';
import invoice from './invoice.vue';
import Statistics from './Statistics.vue';
import sumComponents from './sumComponents.vue';
// import Repcombination from '@/pages/repair/repairReception/customer/combination/Repcombination';
import {
  getfindAllRepairTypeList,
  getbrandsdictList,
  getqueryServiceAssList,
  getseriessdictList,
  getmodelsdictList,
  getcolorinfoList,
  getroLabourByestimateNOList,
  getpartByestimateNOList,
  setrepairEstimate
} from '@/api/repair/business/evaluation/index';
export default {
  name: 'zjEvaluationIndex',
  components: {
    patterns,
    invoice,
    Statistics,
    sumComponents,
    estimate,
    owner
    // Repcombination
  },
  mixins: [dictionary],
  data() {
    return {
      printShow: false,
      fromType: '', // 添加还是编辑状态
      savedata: {},
      topFilterList: this.createTopfilter(),
      activeName: '维修项目',
      estimateVisible: false, // 估价单一级交互显隐
      ownerVisible: false, // 车主信息一级交互显隐
      menus: this.createMenu(),
      params: {
        dmsFuncId: 35100030,
        _: 1566197311051
      },
      estimateData: {
        keyword: '',
        type: ''
      },
      patternData: {
        type: ''
      },
      invoiceData: {
        type: ''
      },
      statisticsData: {
        type: ''
      },
      sumData: {
        type: ''
      },
      lazyMenuData: {
        type: ''
      },
      fromdata: {},
      ownerData: {},
      ownerchilderData: {},
      isRepcombination: false, // 维修组合
      repirlist: [],
      btnDisabled: {
        addbtn: false,
        import: false,
        combination: true,
        save: true,
        emit: true,
        cancel: false,
        void: true,
        export: true,
        Printing1: true,
        Printing2: true
      },
      repairList1: [],
      repairList2: [],
      // 打印
      printList: {}
      //
    };
  },
  mounted() {},
  created() {
    this.getdicList();
  },
  methods: {
    createMenu() {
      let that = this;
      return [
        {
          title: '维修项目',
          path: 'repair/business/evaluation/projectTable',
          disabled: true,
          params: {
            Tlist: [],
            isclear: false,
            code: ''
          },
          on: {
            changeList(val) {},
            syncTablelist(val) {
              console.log(val, '维修项目');
              if (val.length > 0) {
                that.repairList1 = val;
                that.computedFun();
              }
            },
            changeClear(val) {
              that.menus[0].params.isclear = false;
            }
          }
        },
        {
          title: '维修材料',
          path: 'repair/business/evaluation/materialTable',
          disabled: true,
          params: {
            Tlist: [],
            isclear: false,
            code: ''
          },
          on: {
            changeList(val) {},
            syncTablelist(val) {
              console.log(val, '维修材料');
              if (val.length > 0) {
                that.repairList2 = val;
                that.computedFun();
              }
            },
            changeClear(val) {
              that.menus[1].params.isclear = false;
            }
          }
        }
      ];
    },
    createTopfilter() {
      return [
        {
          type: 'INPUT',
          label: '估价单号',
          fieldName: 'ESTIMATE_NO',
          initialValue: '',
          style: { width: '200px' },
          disabled: false,
          unitRender: () => {
            return (
              <div>
                <el-button icon="el-icon-search" onClick={this.seacherFun}></el-button>

                <el-button icon="el-icon-close" onClick={this.delFun}></el-button>
              </div>
            );
          }
        },
        {
          type: 'INPUT',
          label: '车牌号',
          fieldName: 'LICENSE',
          initialValue: '',
          disabled: false,
          rules: [{ required: true, message: '请输入车牌号', trigger: 'blur' }]
        },
        {
          type: 'INPUT',
          label: 'VIN',
          fieldName: 'VIN',
          initialValue: '',
          disabled: true,
          rules: [{ required: true, message: '请输入车牌号', trigger: 'blur' }]
        },
        {
          type: 'INPUT',
          label: '车主',
          fieldName: 'OWNER_NAME',
          initialValue: '',
          disabled: true,
          unitRender: () => {
            return (
              <div>
                <el-button icon="el-icon-search" onClick={this.seacherOwnerFun}></el-button>
              </div>
            );
          }
        },
        {
          type: 'SELECT',
          label: '送修人性别',
          fieldName: 'DELIVERER_GENDER',
          initialValue: '',
          disabled: true,
          itemList: this.createDictList('1006')
        },
        {
          type: 'SELECT',
          label: '维修类型',
          fieldName: 'REPAIR_TYPE_CODE',
          initialValue: '',
          disabled: true,
          itemList: []
        },
        {
          type: 'SELECT',
          label: '服务工程师',
          fieldName: 'SERVICE_ADVISOR',
          initialValue: '',
          disabled: true,
          itemList: []
        },
        {
          type: 'DATE',
          label: '开单日期',
          fieldName: 'RO_CREATE_DATE',
          initialValue: '',
          disabled: true,
          valueFormat: 'yyyy-MM-dd'
        },
        {
          type: 'INPUT',
          label: '送修人',
          fieldName: 'DELIVERER',
          initialValue: '',
          disabled: true
        },
        {
          type: 'INPUT',
          label: '送修人手机',
          fieldName: 'DELIVERER_MOBILE',
          initialValue: '',
          disabled: true
        },
        {
          type: 'INPUT',
          label: '送修人电话',
          fieldName: 'DELIVERER_PHONE',
          initialValue: '',
          disabled: true
        },
        {
          type: 'SELECT',
          label: '品牌',
          fieldName: 'BRAND',
          initialValue: '',
          disabled: true,
          itemList: [],
          change: props => this.selectBrand(props)
        },
        {
          type: 'SELECT',
          label: '车系',
          fieldName: 'SERIES',
          initialValue: '',
          disabled: true,
          itemList: [],
          change: props => this.selectSeries(props)
        },
        {
          type: 'SELECT',
          label: '车型',
          fieldName: 'MODEL',
          initialValue: '',
          disabled: true,
          itemList: []
        },
        {
          type: 'SELECT',
          label: '车辆颜色',
          fieldName: 'COLOR_CODE',
          initialValue: '',
          disabled: true,
          itemList: []
        },
        {
          type: 'DATE',
          label: '结算时间',
          fieldName: 'BALANCE_TIME',
          disabled: true,
          initialValue: '',
          valueFormat: 'yyyy-MM-dd'
        },
        {
          type: 'DATE',
          label: '预交车时间',
          fieldName: 'END_TIME_SUPPOSED',
          disabled: true,
          initialValue: '',
          valueFormat: 'yyyy-MM-dd'
        },
        {
          type: 'SELECT',
          label: '燃油量',
          fieldName: 'OIL_REMAIN',
          initialValue: '',
          disabled: true,
          itemList: this.createDictList('1250')
        },
        {
          type: 'DATE',
          label: '完工时间',
          fieldName: 'ITEM_END_TIME',
          initialValue: '',
          disabled: true,
          valueFormat: 'yyyy-MM-dd'
        },
        {
          type: 'DATE',
          label: '终检时间',
          fieldName: 'CHECK_END_TIME',
          initialValue: '',
          disabled: true,
          valueFormat: 'yyyy-MM-dd'
        },
        {
          type: 'INPUT',
          label: '行驶里程',
          fieldName: 'IN_MILEAGE',
          initialValue: '',
          disabled: true,
          rules: [{ required: true, message: '请输入行驶里程', trigger: 'blur' }]
        },
        {
          type: 'INPUT',
          label: '检查结果',
          fieldName: 'RO_TROUBLE_DESC',
          initialValue: '',
          disabled: true
        },
        {
          type: 'INPUT',
          label: '送修问题',
          fieldName: 'CUSTOMER_DESC',
          initialValue: '',
          disabled: true
        }
      ];
    },
    async getdicList() {
      let res1 = (await getfindAllRepairTypeList(this.params)).map(x => ({ text: x.REPAIR_TYPE_NAME, value: x.REPAIR_TYPE_CODE }));

      let res2 = (await getbrandsdictList(this.params)).map(x => ({ text: x.BRAND_NAME, value: x.BRAND_CODE }));
      let res5 = (await getqueryServiceAssList(this.params)).map(x => ({ text: x.EMPLOYEE_NAME, value: x.EMPLOYEE_NO }));
      // 工时单价

      this.topFilterList[5].itemList = res1;
      this.topFilterList[6].itemList = res5;
      this.topFilterList[11].itemList = res2;
    },
    seacherOwnerFun() {
      this.ownerVisible = true;
    },
    changeHandle(val) {
      this.savedata = val;
    },
    seacherFun() {
      console.log('搜索');
      let content = this.topFilterList[0].initialValue;
      this.estimateData.keyword = content;
      this.estimateVisible = true;
    },
    delFun() {
      console.log('清除');
    },
    closeestimate(val) {
      console.log(val, '估价单取消操作');
      this.estimateVisible = false;
    },
    isValidDate(date) {
      return date instanceof Date && !isNaN(date.getTime());
    },
    async estimateSubmit(val) {
      console.log(val, '估价单确定操作');
      this.fromdata = val;
      this.fromdata.BALANCE_TIME = this.isValidDate(val.BALANCE_TIME) ? moment(val.BALANCE_TIME).format('YYYY-MM-DD') : '';
      this.fromdata.END_TIME_SUPPOSED = this.isValidDate(val.END_TIME_SUPPOSED) ? moment(val.END_TIME_SUPPOSED).format('YYYY-MM-DD') : '';
      this.fromdata.ITEM_END_TIME = this.isValidDate(val.ITEM_END_TIME) ? moment(val.ITEM_END_TIME).format('YYYY-MM-DD') : '';
      this.fromdata.CHECK_END_TIME = this.isValidDate(val.CHECK_END_TIME) ? moment(val.CHECK_END_TIME).format('YYYY-MM-DD') : '';
      this.fromdata.RO_CREATE_DATE = this.isValidDate(val.RO_CREATE_DATE) ? moment(val.RO_CREATE_DATE).format('YYYY-MM-DD') : '';
      console.log(val, this.fromdata.CHECK_END_TIME, 'val.CHECK_END_TIME');
      this.estimateVisible = false;
      this.emitchange();
      for (let i in this.fromdata) {
        this.fromdata[i] = this.fromdata[i] === null ? '' : String(this.fromdata[i]);
        for (let j = 0; j < this.topFilterList.length; j++) {
          if (i == this.topFilterList[j].fieldName) {
            this.topFilterList[j].initialValue = this.fromdata[i];
          }
        }
      }
      this.getlist(val.ESTIMATE_NO);
      if (this.fromdata.BRAND && !this.fromdata.SERIES) {
        let data = Object.assign(
          {},
          {
            dmsFuncId: 35100030,
            _: 1566197311051
          },
          { brand: this.fromdata.BRAND }
        );
        let res = await getseriessdictList(data);
        this.topFilterList[12].itemList = res.map(x => ({ text: x.SERIES_NAME, value: x.SERIES_CODE }));
      } else if (this.fromdata.BRAND && this.fromdata.SERIES) {
        let datas = Object.assign(
          {},
          {
            dmsFuncId: 35100030,
            _: 1566197311051
          },
          { brand: this.fromdata.BRAND }
        );
        let res = await getseriessdictList(datas);
        this.topFilterList[12].itemList = res.map(x => ({ text: x.SERIES_NAME, value: x.SERIES_CODE }));
        let data = Object.assign(
          {},
          {
            dmsFuncId: 35100030,
            _: 1566197311051
          },
          { brand: this.fromdata.BRAND, series: this.fromdata.SERIES }
        );
        let res2 = await getmodelsdictList(data);
        this.topFilterList[13].itemList = res2.map(x => ({ text: x.MODEL_NAME, value: x.MODEL_CODE }));
        let res1 = await getcolorinfoList(data);
        this.topFilterList[14].itemList = res1.map(x => ({ text: x.COLOR_NAME, value: x.COLOR_CODE }));
      }

      this.popFromFun(val);
      // 编辑赋值
    },
    closeOwner(val) {
      console.log('车主弹窗关闭');
      this.ownerVisible = false;
    },
    ownerSubmit(val) {
      console.log(val, '车主弹窗确定操作');
      this.ownerchilderData = val;
      this.ownerVisible = false;
    },
    combinationFun() {
      this.isRepcombination = true;
    },
    // 维修组合关闭弹窗
    closeRepcombination(val) {
      this.isRepcombination = val;
    },
    // 接收维修组合确定返回
    WxxmList(val) {
      console.log(val, '维修组合返回');
      let arr = this.menus[0].params.Tlist || [];
      let arrs = this.menus[1].params.Tlist || [];
      this.menus[0].params.Tlist = arr.concat(val.list1);
      this.menus[1].params.Tlist = arrs.concat(val.list2);
      this.repairList1 = arr.concat(val.list1);
      this.repairList2 = arrs.concat(val.list2);
      this.isRepcombination = false;
    },
    // 车系相关change事件
    async selectBrand(val) {
      console.log(val, '车系');
      let data = Object.assign(
        {},
        {
          dmsFuncId: 35100030,
          _: 1566197311051
        },
        { brand: val }
      );
      let res = await getseriessdictList(data);
      this.topFilterList[12].itemList = res.map(x => ({ text: x.SERIES_NAME, value: x.SERIES_CODE }));
      console.log(res);
    },
    async selectSeries(val) {
      let brand = this.topFilterList[11].initialValue;
      let series = val;
      let data = Object.assign(
        {},
        {
          dmsFuncId: 35100030,
          _: 1566197311051
        },
        { brand: brand, series: series }
      );
      let res = await getmodelsdictList(data);
      this.topFilterList[13].itemList = res.map(x => ({ text: x.MODEL_NAME, value: x.MODEL_CODE }));
      let res1 = await getcolorinfoList(data);
      this.topFilterList[14].itemList = res1.map(x => ({ text: x.COLOR_NAME, value: x.COLOR_CODE }));
    },
    // 改变disblod状态
    emitchange() {
      this.fromType = 'emit';
      this.btnDisabled.addbtn = true;
      this.btnDisabled.import = true;
      this.btnDisabled.combination = false;
      this.btnDisabled.save = false;
      this.btnDisabled.emit = true;
      this.btnDisabled.cancel = false;
      this.btnDisabled.void = true;
      this.btnDisabled.export = true;
      this.btnDisabled.Printing1 = true;
      this.btnDisabled.Printing2 = true;
      this.topFilterList.map((item, key) => {
        if (item.fieldName == 'ESTIMATE_NO' || item.fieldName == 'LICENSE') {
          item.disabled = true;
        } else {
          item.disabled = false;
        }
      });
      this.menus[0].disabled = false;
      this.menus[1].disabled = false;
      this.patternData.type = 'emit';
      this.invoiceData.type = 'emit';
      this.statisticsData.type = 'emit';
      this.sumData.type = 'emit';
    },
    addchange() {
      this.fromType = 'add';
      this.btnDisabled.addbtn = true;
      this.btnDisabled.import = true;
      this.btnDisabled.combination = false;
      this.btnDisabled.save = false;
      this.btnDisabled.emit = true;
      this.btnDisabled.cancel = false;
      this.btnDisabled.void = true;
      this.btnDisabled.export = true;
      this.btnDisabled.Printing1 = false;
      this.btnDisabled.Printing2 = true;
      this.topFilterList.map((item, key) => {
        if (item.fieldName != 'ESTIMATE_NO') {
          item.disabled = false;
        } else {
          item.disabled = true;
        }
      });
      this.menus[0].disabled = false;
      this.menus[1].disabled = false;
      this.patternData.type = 'add';
      this.invoiceData.type = 'add';
      this.statisticsData.type = 'add';
      this.sumData.type = 'add';
    },
    popFromFun(data) {
      let invoiceData = {};
      invoiceData.INVOICE_NO = data.INVOICE_NO || '';
      invoiceData.INVOICE_TYPE_CODE = data.INVOICE_TYPE_CODE || '';
      invoiceData.PAY_TYPE_CODE = data.PAY_TYPE_CODE || '';
      this.invoiceData = Object.assign({}, { type: 'emit' }, invoiceData);
      // let patternData = {};
      // patternData.DISCOUNT_MODE_CODE = data.DISCOUNT_MODE_CODE || '';
      // patternData.LABOUR_PRICE = data.LABOUR_PRICE || '';
      // this.patternData = Object.assign({}, { type: 'emit' }, patternData);
      // this.statisticsData = Object.assign({}, { type: 'emit' });
    },
    // 获取维修项目列表
    async getlist(code) {
      let res = await getpartByestimateNOList({ code: code });
      this.menus[1].params.Tlist = res;
      this.repairList2 = res;
      let res1 = await getroLabourByestimateNOList({ code: code });
      this.menus[0].params.Tlist = res1;
      this.repairList1 = res1;
      this.computedFun();
    },
    computedFun() {
      let num = 0,
        num1 = 0,
        num2 = 0,
        num3 = 0;
      this.repairList1.forEach(x => {
        let y = typeof x.LABOUR_AMOUNT != 'number' ? 0 : x.LABOUR_AMOUNT;
        num = num + y;
      });
      this.repairList2.forEach(x => {
        let y = typeof x.RECEIVE_AMOUNT != 'number' ? 0 : x.RECEIVE_AMOUNT;
        num1 = num1 + y;
      });
      this.repairList2.forEach(x => {
        let y = typeof x.PART_SALES_PRICE != 'number' ? 0 : x.PART_SALES_PRICE;
        num2 = num2 + y;
      });
      this.repairList1.forEach(x => {
        let y = typeof x.RECEIVE_AMOUNT != 'number' ? 0 : x.RECEIVE_AMOUNT;
        num3 = num3 + y;
      });
      console.log(num, num1, num2, num3, this.repairList2, this.repairList1);
      this.sumData = {
        type: 'emit',
        RECEIVE_AMOUNT: num + num2,
        WORK_ORDER_NUMBER: num1 + num3
      };
      this.statisticsData = {
        type: 'emit',
        LABOUR_AMOUNT: num,
        PART_SALES_AMOUNT: num2,
        shishou: num1,
        REPAIR_PART_AMOUNT: num3
      };
    },
    // 保存
    async saveDataFun() {
      let tag = this.fromType == 'add' ? 'A' : 'U';
      this.$refs.topFilter.SUBMIT_FORM();
      for (let i = 0; i < this.repairList2.length; i++) {
        this.repairList2[i].LABOUR_CODE = this.repairList2[i].LABOUR_CODE + '~' + i;
      }
      for (let i = 0; i < this.repairList1.length; i++) {
        this.repairList1[i].LABOUR_INDEX = String(i);
      }
      if (this.savedata != null) {
        let json = JSON.parse(JSON.stringify(this.savedata));
        let data = {
          tag: tag,
          estimateNo: json.ESTIMATE_NO,
          roNo: json.RO_NO,
          license: json.LICENSE,
          vin: json.VIN,
          ownerNo: json.OWNER_NO,
          ownerName: json.OWNER_NAME,
          delivererGender: json.DELIVERER_GENDER,
          repairTypeCode: json.REPAIR_TYPE_CODE,
          serviceAdvisor: json.SERVICE_ADVISOR,
          roCreateDate: json.RO_CREATE_DATE,
          deliverer: json.DELIVERER,
          delivererMobile: json.DELIVERER_MOBILE,
          delivererPhone: json.DELIVERER_PHONE,
          brand: json.BRAND,
          series: json.SERIES,
          model: json.MODEL,
          color: json.COLOR,
          balanceTime: json.BALANCE_TIME,
          endTimeSupposed: json.END_TIME_SUPPOSED,
          oilRemain: json.OIL_REMAIN,
          itemEndTime: json.ITEM_END_TIME,
          checkEndTime: json.CHECK_END_TIME,
          inMileage: json.IN_MILEAGE,
          roTroubleDesc: json.RO_TROUBLE_DESC,
          customerDesc: json.CUSTOMER_DESC,
          discountModeCode: json.DISCOUNT_MODE_CODE,
          labourPrice: json.LABOUR_PRICE,
          contractNo: json.CONTRACT_NO,
          contractCard: json.CONTRACT_CARD,
          invoiceNo: json.INVOICE_NO,
          invoiceTypeCode: json.INVOICE_TYPE_CODE,
          payTypeCode: json.PAY_TYPE_CODE,
          labourAmount: json.LABOUR_AMOUNTS,
          partAmount: json.PART_SALES_AMOUNT,
          partSalesAmount: json.PART_SALES_AMOUNTS,
          addItemAmount: json.ADD_ITEM_AMOUNT,
          netAmount: json.NET_AMOUNT,
          taxAmount: json.NET_AMOUNT,
          balanceAmount: json.WORK_ORDER_NUMBER,
          subObbAmount: json.SUB_OBB_AMOUNT,
          receiveAmount: json.RECEIVE_AMOUNT,
          projectlist: this.repairList1,
          partlist: this.repairList2
        };
        if (json.ESTIMATE_NO) {
          data.estimateNo = json.ESTIMATE_NO;
        }
        if (json.BALANCE_TIME == '') {
          delete data.balanceTime;
        }
        if (json.RO_TROUBLE_DESC == '') {
          delete data.roCreateDate;
        }
        if (json.ITEM_END_TIME == '') {
          delete data.itemEndTime;
        }
        if (json.CHECK_END_TIME == '') {
          delete data.checkEndTime;
        }
        if (json.END_TIME_SUPPOSED == '') {
          delete data.endTimeSupposed;
        }
        if (json.RO_CREATE_DATE == '') {
          delete data.roCreateDate;
        }

        if (json.OIL_REMAIN == '') {
          data.oilRemain = null;
        }
        let res = await setrepairEstimate(data);
        console.log(res, 'res');
      }
    },
    cancelFun() {
      // 取消
      this.fromType = '';
      this.btnDisabled.addbtn = false;
      this.btnDisabled.import = false;
      this.btnDisabled.combination = true;
      this.btnDisabled.save = true;
      this.btnDisabled.emit = true;
      this.btnDisabled.cancel = false;
      this.btnDisabled.void = true;
      this.btnDisabled.export = true;
      this.btnDisabled.Printing1 = true;
      this.btnDisabled.Printing2 = true;
      this.topFilterList.map((item, key) => {
        if (item.fieldName != 'ESTIMATE_NO') {
          item.disabled = true;
        } else {
          item.disabled = false;
        }
        item.initialValue = '';
      });
      this.menus[0].disabled = true;
      this.menus[1].disabled = true;
      this.patternData.type = '';
      this.invoiceData.type = '';
      this.statisticsData.type = '';
      this.sumData.type = '';
      this.menus[0].params.isclear = true;
      this.menus[1].params.isclear = true;
    },
    // 打印
    Printing1Fun() {
      this.printShow = true;
      this.$nextTick(() => {
        this.$refs.print.EXCUTE_PRINT();
      });
    }
  }
};
</script>
<style lang="less">
.fromTop {
  border-radius: 4px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  padding: 10px;
  margin-bottom: 10px;
}
.table_main {
  clear: both;
  height: 410px;
  .main_left {
    width: 75%;
    height: 400px;
    float: left;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    padding: 10px;
    padding-left: 10px;
    padding-bottom: 0;
  }
  .main_right {
    width: calc(25% - 30px);
    float: right;
    height: 400px;
    min-width: 200px;
  }
}
.table_lang {
  clear: both;
  width: 100%;
  margin-top: 10px;
  height: 250px;
  .lang_left {
    width: 75%;
    float: left;
    padding: 0 10px;
    border-radius: 4px;
    height: 250px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    position: relative;
    .Statisticsbox {
      width: 100%;
      height: 100px;
      border-bottom: 1px solid #c0c4cc;
      margin-top: 15px;
    }
  }
  .lang_right {
    width: calc(25% - 30px);
    float: right;
    height: 250px;
    min-width: 200px;
  }
  .btn_top {
    position: absolute;
    left: 50%;
    transform: translate(-50%, 0);
    margin-top: 30px;
  }
  .btn_bottom {
    position: absolute;
    left: 50%;
    transform: translate(-50%, 0);
    margin-top: 70px;
  }
}
</style>
